package com.lzy.huijinjiazu.mvp.ui.adapter;

import android.graphics.Paint;
import android.text.Html;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.flyco.roundview.RoundTextView;
import com.jess.arms.utils.ArmsUtils;
import com.lzy.huijinjiazu.R;
import com.lzy.huijinjiazu.mvp.ui.widget.TagGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by long on 2018/1/8.
 */

public class TourismAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    public TourismAdapter() {
        super(R.layout.item_tourism);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        TagGroup tgList = helper.getView(R.id.tg_list);
        productionView(tgList, null);
        ((TextView) helper.getView(R.id.tv_moeny)).setText(Html.fromHtml(ArmsUtils.getString(mContext, R.string.symbol_moeny, "3298")));
        TextView tvOriginalPrice = helper.getView(R.id.tv_original_price);
        tvOriginalPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    }

    private void productionView(TagGroup tgList, List<String> data) {
        if (tgList.getChildCount() > 0) {
            return;
        }
        data = new ArrayList<>();
        data.add("开心旅行");
        data.add("开心旅行");
        tgList.setList(data);
        for (int i = 0; i < tgList.getChildCount(); i++) {
            RoundTextView tvView = (RoundTextView) tgList.getChildAt(i);
            tvView.setText(data.get(i));
            tvView.getDelegate().setStrokeColor(0xffe57f14);
            tvView.setTextColor(0xffe57f14);
            tvView.getDelegate().setBackgroundColor(0x00000000);
            tvView.setTextSize(9);
            tvView.setPadding(15, 5, 15, 5);
        }
    }
}
